//
//  HomePageCell.m
//  PersonnelWashCar
//
//  Created by 就是这么自信 on 16/4/22.
//  Copyright © 2016年 张越. All rights reserved.
//

#import "HomePageCell.h"

@implementation HomePageCell

- (void)awakeFromNib {
    self.didBtn.layer.cornerRadius = 5;
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}

-(void)setHomepageModel:(HomePageModel *)model
{
    self.adreesLabel.text = model.carlocation;
    self.carNubLabel.text = model.carnum;
    self.typeLabel.text = model.name;
    self.timeLable.text = model.ordertime;
    self.priceLabe.text = [NSString stringWithFormat:@"¥%@",model.price];
    self.oid = model.oid;
    self.sn = model.sn;
//    self.reasonLabel.text = model.reason;
    NSString *is_grab = [NSString stringWithFormat:@"%@",model.is_grab];
    if([is_grab isEqualToString:@"1"])
    {
        self.didBtn.enabled = YES;
        self.priceLabe.text = [NSString stringWithFormat:@"¥%@",model.price];
        self.priceLabe.font = [UIFont systemFontOfSize:18];
        [self.didBtn setBackgroundColor:[UIColor colorWithRed:0.180 green:0.608 blue:0.867 alpha:1.000]];
    }else{
        self.didBtn.enabled = NO;
        self.priceLabe.text = [NSString stringWithFormat:@"%@",model.reason];
        self.priceLabe.font = [UIFont systemFontOfSize:12];
        [self.didBtn setBackgroundColor:[UIColor colorWithWhite:0.851 alpha:1.000]];
    }
    
}

- (IBAction)didOrder_Action:(id)sender {
    if (self.ReturnStringBlock) {
        NSString *oid = self.oid;
        NSString *sn = self.sn;
        self.ReturnStringBlock(oid,sn);
    }
}

@end
